/-- warpPos()--//
warpPos(vector pos)
{
    list rules;
    integer num = llRound(llVecDist(llGetPos(),pos)/10)+1;
    integer x;
    for(x=0; x<num; ++x) rules=(rules=[])+rules+[PRIM_POSITION,pos];
    llSetPrimitiveParams(rules);
}
//-------------//
integer status = FALSE;
list msg;
string command;
integer beamup = FALSE;
vector Pos;
float a;

default
{
    state_entry()
    {
        llSetStatus(STATUS_PHANTOM, TRUE);
        llListen(-658572700,"","","");
        llSleep(0.2);
        llParticleSystem([5,<0.00,0.20,0.00>,6,<2.50,2.50,0.00>, 1,<1.00,1.00,1.00>,3,<0.00,0.00,0.00>, 2,0.00,4,1.00,15,1, 13,0.05,7,4.00,19,0.00,9,2, 17,0.00,18,0.00,16,1.50,22,0.00,23,0.00,21,<0.00,0.00,0.00>, 8,<0.00,0.00,0.00>, 0,355 ] );
        llSetTimerEvent(120);

    }

    on_rez(integer start_param)
    {
        llResetScript();
    }

    listen(integer channel,string name,key id,string message)
    {
        msg = llParseString2List(llToLower(message),["||"],[""]);
        command = llList2String(msg ,0);
        if(command == "warp")
        {
            Pos = (vector)llList2String(msg, 1);
            status = TRUE;
        }

        else if(command == "beamup")
        {
            Pos = (vector)llList2String(msg, 1);
            warpPos(Pos);
            status = TRUE;
            beamup = TRUE;
        }

        else if(message == "ClearBeam||PAD")
        {
            llDie();
        }
    }
    timer()
    {
        llDie();
    }
    changed(integer change)
    {
        if(change & CHANGED_LINK)
        {
            key user = llAvatarOnSitTarget();
            if(beamup == TRUE)
            {
                list AvPos = llGetObjectDetails(llGetOwner(), ([OBJECT_POS]));
                Pos = llList2Vector(AvPos,0) + <1.0, 0.0, 0.2>;
                beamup = FALSE;
            }
            if(status == TRUE)
            {
                status = FALSE;
                llMessageLinked(LINK_SET,0,"beamon","");
                llSleep(1.0);
                warpPos(Pos);
                llSleep(0.5);
                llDie();
            }
            else if(status == FALSE)
            {
                llSleep(2.0);
                llMessageLinked(LINK_SET,0,"beamon","");
                llSleep(1.0);
                warpPos(Pos);
                llSleep(0.5);
                llDie();
            }
        }
    }
}